import datetime
from flask import g
from sqlalchemy import or_
from sqlalchemy.exc import PendingRollbackError
from werkzeug.security import generate_password_hash
import time
from home import db
from faker import Faker
import random

'''
虚拟数据
通过faker库生成，真随机
每一次生成就提交一次，期间需要对数据表中的唯一值进行判断，避免产生相同数据之后不能继续写数据


'''


# 定义enterprise与job多对多关系表
class HRAndJobModel(db.Model):
    __tablename__ = "hr_job"
    id = db.Column(db.Integer, primary_key=True)

    jobId = db.Column(db.String(255), db.ForeignKey("job.jobId"), nullable=False)
    hrId = db.Column(db.String(255), db.ForeignKey("hr.hrId"), nullable=False)

    # 初始化数据
    @staticmethod
    def init_db():
        # 自定义优先
        hj1 = HRAndJobModel(jobId="1", hrId="h1")
        hj2 = HRAndJobModel(jobId="2", hrId="h2")
        hj3 = HRAndJobModel(jobId="3", hrId="h1")
        try:
            # db.session.add_all([hj1,hj2,hj3])
            db.session.add_all([hj1, hj2, hj3])
            db.session.commit()
        except:
            print(11)


        jobs = JobModel.query.all()
        hrs = HRModel.query.all()
        for i in range(len(jobs)):
            ran_hr = random.randint(0, len(hrs) - 1)
            new = HRAndJobModel(
                jobId=jobs[i].jobId,
                hrId=hrs[ran_hr].hrId
            )
            try:
                db.session.add(new)
                db.session.commit()
            except:
                db.session.rollback()



# 定义user与job多对多关系表
class UserAndJobModel(db.Model):
    # 申请和收藏：已申请1，未申请0，已收藏1，未收藏0
    __tablename__ = "user_job"
    id = db.Column(db.Integer, primary_key=True)
    jobId = db.Column(db.String(255), db.ForeignKey("job.jobId"), nullable=False)
    uId = db.Column(db.String(255), db.ForeignKey("user.uId"), nullable=False)
    isApply = db.Column(db.String(255))
    isCollection = db.Column(db.String(255))
    applyState = db.Column(db.String(255))
    stateContent = db.Column(db.String(255))

    # 初始化数据
    @staticmethod
    def init_db():

        # 全局
        global ba, bc
        faker = Faker(locale="zh_CN")
        jobs = JobModel.query.all()
        users = UserModel.query.all()
        # 随机条申请或收藏的记录 如30条
        i = 100
        while i > 0:
            ran_j = random.randint(0, len(jobs) - 1)  # 随机一个岗位
            ran_u = random.randint(0, len(users) - 1)  # 随机一个求职者

            boo = faker.boolean(chance_of_getting_true=50)
            if boo is True:
                ba = "true"
                bc = random.choice(["false", "true"])
            if boo is False:
                ba = "false"
                bc = "true"
            new = UserAndJobModel(
                jobId=jobs[ran_j].jobId,
                uId=users[ran_u].uId,
                isApply=ba,
                isCollection=bc,
                applyState=random.choice(["待查看", "已通过", "未通过"]),
                stateContent = faker.word(ext_word_list=None)
            )
            try:
                UJ = UserAndJobModel.query.filter_by(jobId=ran_j, uId=ran_u).first()
                if not UJ:

                    i = i - 1
                    db.session.add(new)
                    db.session.commit()


            except:
                db.session.rollback()

                # 自定义优先
                # 第一个人申请同一家公司的不同岗位
        uj1 = UserAndJobModel(
            jobId="1",
            uId="u1",
            isApply="true",
            isCollection="false",
            applyState="待查看",
            stateContent="",
        )
        uj2 = UserAndJobModel(
            jobId="2",
            uId="u1",
            isApply="true",
            isCollection="true",
            applyState="已通过",
            stateContent="后续将电话联系您"
        )
        # 第二个人和第一个人竞争同一家公司的同一个岗位
        uj3 = UserAndJobModel(
            jobId="1",
            uId="u2",
            isApply="true",
            isCollection="true",
            applyState="已通过",
            stateContent="后续将电话联系您"
        )
        # 第一个人申请两家公司的岗位
        uj4 = UserAndJobModel(
            jobId="3",
            uId="u1",
            isApply="true",
            isCollection="false",
            applyState="未通过",
            stateContent="不好意思，您不符合我们的要求"
        )
        try:
            db.session.add_all([uj1, uj2, uj3, uj4])

            db.session.commit()
        except:
            db.session.rollback()
        # for apply in applys:
        #     userAndJobModel = UserAndJobModel()
        #     userAndJobModel.jobId = apply.jobId
        #     userAndJobModel.uId = apply.uId
        #     userAndJobModel.isApply = apply.isApply
        #     userAndJobModel.isCollection = apply.isCollection
        #
        #     db.session.add(apply)
        # db.session.commit()


# 定义用户model
class UserModel(db.Model):
    __tablename__ = "user"
    uId = db.Column(db.String(255), nullable=False, primary_key=True)  # 时间戳
    # 基本信息
    avatarName = db.Column(db.String(255))
    gander = db.Column(db.String(255))

    name = db.Column(db.String(255))
    birth = db.Column(db.String(255))
    birthAddress = db.Column(db.String(255))
    newAddress = db.Column(db.String(255))
    politicalOutlook = db.Column(db.String(255))

    phone = db.Column(db.String(255), unique=True)
    email = db.Column(db.String(255), unique=True)
    password = db.Column(db.String(255))

    jobs = db.relationship("JobModel", backref="user_list", lazy="dynamic", secondary="user_job")

    # 初始化数据
    @staticmethod
    def init_db():
        from Hook.hook import getAddr
        faker = Faker(locale="zh_CN")

        i = 50
        while i > 0:
            email = faker.free_email()
            phone = faker.phone_number()
            new = UserModel(
                uId=faker.ssn(min_age=18, max_age=90),
                name=faker.name(),
                phone=phone,
                password=generate_password_hash("123456"),
                email=email,
                avatarName="avatar_1.jpeg",
                gander=random.choice(["男", "女"]),
                birth=faker.date(pattern="%Y-%m", end_datetime=None),
                birthAddress=getAddr(),
                newAddress=getAddr(),
                politicalOutlook=random.choice(["团员", "党员"]),
            )
            try:
                u = UserModel.query.filter(or_(UserModel.phone == phone, UserModel.email == email)).all()
                if not u:
                    db.session.add(new)
                    db.session.commit()
                    i = i - 1

            except PendingRollbackError as e:
                db.session.rollback()
                print(e)

        u1 = UserModel(
            uId="u1",
            name="张三", phone="15679466522", password=generate_password_hash("123456"), email="a1@a.com",
            avatarName="avatar_1.jpeg"
            , gander="男", birth="2000-10", birthAddress='广西壮族自治区-玉林市', newAddress="广西壮族自治区-河池市",
            politicalOutlook="团员",

        )

        u2 = UserModel(
            uId="u2",
            name="李四", phone="15648999665", password=generate_password_hash("123456"), email="a2@a.com",
            avatarName="1.jpeg"
            , gander="男", birth="2005-10", birthAddress='北京市-市辖区', newAddress="山东省-济南市",
            politicalOutlook="党员",

        )
        db.session.add(u1)
        db.session.commit()
        db.session.add(u2)
        db.session.commit()
        # for user in users:
        #     userModel = UserModel()
        #
        #     userModel.name = user.name
        #     userModel.phone = user.phone
        #     userModel.password = user.password
        #     userModel.email = user.email
        #     userModel.gander = user.gander
        #     userModel.birth = user.birth
        #     userModel.birthAddress = user.birthAddress
        #     userModel.newAddress = user.newAddress
        #     userModel.politicalOutlook = user.politicalOutlook
        #
        #     db.session.add(user)
        # db.session.commit()


class UserResumeModel(db.Model):
    __tablename__ = "userresume"
    id = db.Column(db.Integer, primary_key=True)
    # 工作状态
    jobState = db.Column(db.String(255))
    # 求职意向
    jobTitle = db.Column(db.String(255))
    jobSalary = db.Column(db.String(255))
    jobCity = db.Column(db.String(255))
    jobNature = db.Column(db.String(255))
    jobIndustry = db.Column(db.String(255))
    # 教育经历
    eduSchoolName = db.Column(db.String(255))
    eduEducation = db.Column(db.String(255))
    eduMajor = db.Column(db.String(255))
    schoolTime = db.Column(db.String(255))
    eduMajorDetail = db.Column(db.Text(65535))

    # 工作经验
    jobExTime = db.Column(db.String(255))
    jobExEnterprise = db.Column(db.String(255))
    jobExLevel = db.Column(db.String(255))
    jobExDetail = db.Column(db.Text(65535))

    # 项目经验
    projectTime = db.Column(db.String(255))
    projectEnterprise = db.Column(db.String(255))
    projectName = db.Column(db.String(255))
    projectDetail = db.Column(db.Text(65535))

    # 荣誉奖项
    userHonors = db.Column(db.String(255))
    # 自我评价
    userSelfEvaluation = db.Column(db.Text(65535))

    uId = db.Column(db.String(255), db.ForeignKey('user.uId'))

    #
    # 初始化数据
    @staticmethod
    def init_db():
        from Hook.hook import getAddr, getJobIndustry,getDate
        industry = getJobIndustry()
        faker = Faker(locale="zh_CN")
        resumes = []
        users = UserModel.query.all()
        for i in users:
            id = UserResumeModel.query.filter_by(uId=i.uId).first()
            if not id:

                resumes.append(
                    UserResumeModel(
                        uId=i.uId,
                        jobState=random.choice(["在校-暂不找工作", "离校-正在找工作", "在校-看看机会", "在校-暂不找工作"]),
                        # 求职意向
                        jobTitle=faker.job(),
                        jobSalary=random.choice(
                            ["3000-6000", "4000-8000", "6000-9000", "4000-9000", "5000-8000", "3000-5000"]),
                        jobCity=getAddr(),
                        jobNature=random.choice(["全职", "兼职", "实习"]),
                        jobIndustry=industry,
                        # 教育经历
                        eduSchoolName=faker.city_name() + "大学",
                        eduEducation=random.choice(["初中", "高中", "大专", "本科", "研究生"]),
                        eduMajor=faker.word(),
                        schoolTime=getDate(),
                        eduMajorDetail=faker.text(max_nb_chars=200, ext_word_list=None),
                        # 工作经验
                        jobExTime=getDate(),
                        jobExEnterprise=faker.word(),
                        jobExLevel=faker.word(),
                        jobExDetail=faker.text(max_nb_chars=200, ext_word_list=None),

                        # 项目经验
                        projectTime=getDate(),
                        projectEnterprise=faker.word(),
                        projectName=faker.word(),
                        projectDetail=faker.text(max_nb_chars=200, ext_word_list=None),

                        # 荣誉奖项
                        userHonors="-".join(faker.word()),
                        # 自我评价
                        userSelfEvaluation=faker.text(max_nb_chars=200, ext_word_list=None),

                    )
                )

        resumes.append(UserResumeModel(
            uId="u1",
            jobState="在校-暂不找工作",
            # 求职意向
            jobTitle="Python",
            jobSalary="3000-6000",
            jobCity="全国地区不限",
            jobNature="实习",
            jobIndustry="计算机软件",
            # 教育经历
            eduSchoolName="河池学院",
            eduEducation="本科",
            eduMajor="网络工程",
            schoolTime="2019.9-2023.6",
            eduMajorDetail="rihgolordehg",
            # 工作经验
            jobExTime="2019.9-2020.10",
            jobExEnterprise="华为",
            jobExLevel="经理",
            jobExDetail="dasdad",

            # 项目经验
            projectTime="2020.6-2020.10",
            projectEnterprise="华为",
            projectName="数据分析",
            projectDetail="dasdad",

            # 荣誉奖项
            userHonors='华为IE认证-计算机等级四级-英语八级-软考网工-绿盟认证-思科NE认证',
            # 自我评价
            userSelfEvaluation='''本人思想端正、积极向上、适应力强，有管理、组织能力。工作中能吃苦肯钻研，能承受较强工作压力，注重长期稳定的发展机会、谈判及沟通/协调能力强。强烈的工作责任心及优秀的问题分析与处理能力，强烈的团队协作意识、结果导向及成本控制意识强，并且从事的每项工作都能很好的完成。
    能吃苦耐劳，工作细心责任、态度严谨、有较强的团队合作创新意识。热情、诚信、善于与人进行技术交流合作，能适应在压力下工作。对待工作认真负责，不拖拖拉拉，吃苦耐劳，坚韧不拔。希望能够为公司贡献自己的一份力量，把公司发展壮大。
    ''',

        ))
        resumes.append(
            UserResumeModel(
                uId="u2",
                jobState="在校-看看机会",
                jobTitle="Java",
                jobSalary="9000-12000",
                jobCity="广东省-深圳市",
                jobNature="全职",
                jobIndustry="计算机软件",

                eduSchoolName="五道口职业技术学院",
                eduEducation="研究生",
                eduMajor="软件工程",
                schoolTime="2018.9-2022.6",
                eduMajorDetail="rtthyrthfdswew",
                # 工作经验
                jobExTime="2018.9-2018.10",
                jobExEnterprise="百度",
                jobExLevel="啥也不是",
                jobExDetail="dasdad",

                # 项目经验
                projectTime="2018.9-2018.10",
                projectEnterprise="百度",
                projectName="阿宋海峰",
                projectDetail="dasdad",

                # 荣誉奖项

                userHonors='华为IE认证-计算机等级四级-英语八级-软考网工-绿盟认证-思科NE认证',
                # 自我评价
                userSelfEvaluation='''本人思想端正、积极向上、适应力强，有管理、组织能力。工作中能吃苦肯钻研，能承受较强工作压力，注重长期稳定的发展机会、谈判及沟通/协调能力强。强烈的工作责任心及优秀的问题分析与处理能力，强烈的团队协作意识、结果导向及成本控制意识强，并且从事的每项工作都能很好的完成。
                    能吃苦耐劳，工作细心责任、态度严谨、有较强的团队合作创新意识。热情、诚信、善于与人进行技术交流合作，能适应在压力下工作。对待工作认真负责，不拖拖拉拉，吃苦耐劳，坚韧不拔。希望能够为公司贡献自己的一份力量，把公司发展壮大。
                    ''',
            )
        )

        for resume in resumes:
            userResumeModel = UserResumeModel()
            userResumeModel.uId = resume.uId
            userResumeModel.jobState = resume.jobState
            userResumeModel.jobTitle = resume.jobTitle
            userResumeModel.jobSalary = resume.jobSalary
            userResumeModel.jobCity = resume.jobCity
            userResumeModel.jobNature = resume.jobNature
            userResumeModel.jobIndustry = resume.jobIndustry

            userResumeModel.eduSchoolName = resume.eduSchoolName
            userResumeModel.eduEducation = resume.eduEducation
            userResumeModel.eduMajor = resume.eduMajor
            userResumeModel.schoolTime = resume.schoolTime
            userResumeModel.eduMajorDetail = resume.eduMajorDetail

            userResumeModel.jobExTime = resume.jobExTime
            userResumeModel.jobExEnterprise = resume.jobExEnterprise
            userResumeModel.jobExLevel = resume.jobExLevel
            userResumeModel.jobExDetail = resume.jobExDetail

            userResumeModel.projectTime = resume.projectTime
            userResumeModel.projectEnterprise = resume.projectEnterprise
            userResumeModel.projectName = resume.projectName
            userResumeModel.projectDetail = resume.projectDetail

            userResumeModel.userHonors = resume.userHonors

            userResumeModel.userSelfEvaluation = resume.userSelfEvaluation

            db.session.add(resume)

        db.session.commit()


# 定义公司model
class EnterpriseModel(db.Model):
    __tablename__ = "enterprise"
    # id = db.Column(db.Integer, nullable=False, autoincrement=True, primary_key=True)

    eId = db.Column(db.String(255), nullable=False, primary_key=True)  # 时间戳

    # 基本信息
    avatarName = db.Column(db.String(255))
    content = db.Column(db.Text(65535))
    size = db.Column(db.String(255))
    nature = db.Column(db.String(255))
    industry = db.Column(db.String(255))
    advantage = db.Column(db.String(255))
    # 联系方式和地址
    contactName = db.Column(db.String(255))
    contactPhone = db.Column(db.String(255))
    contactEmail = db.Column(db.String(255))
    contactAddress = db.Column(db.String(255))

    # 工商信息
    businessName = db.Column(db.String(255), unique=True)
    businessSetTime = db.Column(db.String(255))
    businessRegCapital = db.Column(db.String(255))
    businessLegalRepresentative = db.Column(db.String(255))

    # e_jobs=db.relationship("JobModel", backref="e_list", lazy="dynamic", secondary="e_job")
    hrs = db.relationship("HRModel", backref="e_hr")

    # 初始化数据
    @staticmethod
    def init_db():
        faker = Faker(locale="zh_CN")
        enterprises = []
        i = 30
        while i > 0:
            eName = faker.company()
            new = EnterpriseModel(
                # eId=str(int(time.time()*1000)),
                eId=str(int(time.time() * 1000)) + str(i),
                avatarName="iwu.jpeg",
                content=faker.text(max_nb_chars=200, ext_word_list=None),
                size=random.choice(["20-99", "100-299", "300-499", "500-999"]),
                nature=random.choice(["国有企业", "私营企业", "集体企业"]),
                industry=faker.word(ext_word_list=None),
                advantage="-".join(faker.words(nb=6, ext_word_list=None, unique=False)),
                contactName=faker.word(ext_word_list=None),
                contactPhone=faker.phone_number(),
                contactEmail=faker.company_email(),
                contactAddress=faker.address(),
                businessName=eName,
                businessSetTime=faker.date(pattern="%Y-%m-%d", end_datetime=None),
                businessRegCapital=str(random.randint(3, 10000)),
                businessLegalRepresentative=faker.name(),
            )
            try:
                e = EnterpriseModel.query.filter_by(businessName=eName).first()
                if not e:
                    db.session.add(new)
                    db.session.commit()
                    i = i - 1

            except PendingRollbackError as e:
                db.session.rollback()


        e1 = EnterpriseModel(
            # eId=str(int(time.time()*1000)),
            eId="1",
            avatarName="iwu.jpeg",
            content="""广西客源多网络科技有限公司成立于2019年，是一家专注打造直播生态信息共享平台的综合服务机构。
                                主体业务有：豆芽播生态平台运营、主播培训、直播带货、短视频运营，互联网转型咨询、企业网站开发、全网营销 SEO技能培训，品牌推广、资源整合、知识产权保护、企业品牌资产加速系统等业务，为各行业在直播领域发展及互联网转型提供高价值、可落地的综合解决方案！公司秉承诚信、高效、合作、感恩的经营理念，通过专业的互联网团队打造线上品牌，公司丰富的资源和资本的高度融合，共同打造共享共赢的生态联盟体，朝着帮助全天下企业互联网转型，轻松实现产品销售的企业使命不断前行！""",
            size="99-500",
            nature="国有企业",
            industry="计算机软件",
            advantage="绩效奖金-无试用期-定期培训-多次晋升机会-每年多次调薪-五险一金",
            contactName="hr2",
            contactPhone="564565",
            contactEmail="h2@h.com",
            contactAddress="南宁市西乡塘区东凯国际商业广场",
            businessName="aaaaaa",
            businessSetTime="2000-10-1",
            businessRegCapital="200",
            businessLegalRepresentative="wu",
        )

        e2 = EnterpriseModel(
            eId="2",
            avatarName="avatar_1.jpeg",
            content="""央广网北京10月7日消息 据中央广播电视总台中国之声《新闻和报纸摘要》报道，中国外交部发言人6日就中方在联合国人权理事会挫败涉疆决定草案答记者问。
                        有记者问：10月6日，联合国人权理事会第51届会议对美国牵头提交的一项涉疆问题决定草案进行表决，最终以失败告终。
                        中方对此有何评论？发言人表示，一段时间以来，美国及一些西方国家反复借涉疆问题造谣生事，打着人权旗号搞政治操弄，企图抹黑中国形象、遏制中国发展。
                        他们无视事实真相，在人权理事会散布涉疆谎言谬论，炮制出一份所谓决定草案，企图利用联合国人权机构干涉中国内政，推进其“以疆制华”图谋。国际社会的眼睛是雪亮的。
                        虽然美国及一些西方国家竭力向其他成员国施压，但这份决定草案仍遭到人权理事会多数成员特别是广大发展中成员的强烈反对，美国等西方国家图谋再次失败。
                        发言人表示，人权理事会真正应该关注和讨论的是美国、英国等西方国家严重侵犯人权问题，包括系统性种族主义和种族歧视、侵犯难移民权利、枪支暴力泛滥、滥施单边强制措施、海外军事行动造成大量无辜民众伤亡等，还广大受害者一个公道，给国际社会一个交代。
                        我们奉劝美国等西方国家放弃政治操弄、造假抹黑和无理打压，回到对话合作轨道上来，为国际人权事业发展真正做些实事。""",
            size="300-500",
            nature="私营企业",
            industry="半导体",
            advantage="五险一金-全额社保-全额公积金-项目奖金-餐补-定期体检",
            contactName="hr3",
            contactPhone="1354656",
            contactEmail="h3@h.co",
            contactAddress="五道口职业技术学院旁的大树下",
            businessName="tttttt",
            businessSetTime="2001-10-1",
            businessRegCapital="500",
            businessLegalRepresentative="tian",
        )

        try:
            db.session.add(e1)
            db.session.commit()
            db.session.add(e2)
            db.session.commit()
        except Exception as e:
            print(e)
        # for enterprise in enterprises:
        #     enterpriseModel = EnterpriseModel()
        #
        #     enterpriseModel.eId = enterprise.eId
        #     enterpriseModel.avatarName = enterprise.avatarName
        #     enterpriseModel.content = enterprise.content
        #     enterpriseModel.size = enterprise.size
        #     enterpriseModel.nature = enterprise.nature
        #     enterpriseModel.industry = enterprise.industry
        #     enterpriseModel.advantage = enterprise.advantage
        #
        #     enterpriseModel.contactName = enterprise.contactName
        #     enterpriseModel.contactPhone = enterprise.contactPhone
        #     enterpriseModel.contactEmail = enterprise.contactEmail
        #     enterpriseModel.contactAddress = enterprise.contactAddress
        #
        #     enterpriseModel.businessName = enterprise.businessName
        #     enterpriseModel.businessSetTime = enterprise.businessSetTime
        #     enterpriseModel.businessRegCapital = enterprise.businessRegCapital
        #     enterpriseModel.businessLegalRepresentative = enterprise.businessLegalRepresentative
        #     db.session.add(enterprise)
        # db.session.commit()


# 岗位信息
class JobModel(db.Model):
    __tablename__ = "job"
    jobId = db.Column(db.String(255), primary_key=True, nullable=False)
    jobName = db.Column(db.String(255))
    jobAddress = db.Column(db.String(255))
    jobEdu = db.Column(db.String(255))
    jobNature=db.Column(db.String(255))
    jobAge = db.Column(db.String(255))
    jobEx = db.Column(db.String(255))
    jobSalary = db.Column(db.String(255))
    jobDetail = db.Column(db.Text(65535))
    jobIndustry = db.Column(db.String(255))
    jobState = db.Column(db.String(255))
    isPublishing = db.Column(db.String(255))

    # e_job_id = db.Column(db.String(255), db.ForeignKey("enterprise.eId"))

    # e_job_id= db.relationship("UserModel", backref="job_list", lazy="dynamic", secondary=UserAndJobTable)

    # 初始化数据
    @staticmethod
    def init_db():
        from Hook.hook import getJobIndustry
        faker = Faker(locale="zh_CN")

        for i in range(100):
            new = JobModel(
                jobId=str(int(time.time() * 1000)) + str(i),
                jobName=faker.job(),
                jobEdu=random.choice(["大专", "本科", "研究生"]),
                jobEx=random.choice(["经验不限", "1年以下", "2-3年"]),
                jobAge=random.choice(["年龄不限", "18岁以上", "20-45岁"]),
                jobNature=random.choice(["全职", "兼职", "实习"]),
                jobAddress=faker.address(),
                jobSalary=random.choice(["11K~15K", "4K~6K", "3K~5K", "11K~21K", "30K~40K", "7K~10K"]),
                jobIndustry=getJobIndustry(),
                isPublishing=str(faker.boolean(chance_of_getting_true=50)).lower(),
                # jobState=random.choice(["正在招聘", "已停止招聘", "已被撤销"]),
                jobState=faker.word(),
                jobDetail=faker.text(max_nb_chars=200, ext_word_list=None),

            )
            try:
                db.session.add(new)
                db.session.commit()
            except:
                db.session.rollback()

        j1 = JobModel(
            jobId="1",
            jobName="Java开发工程师（中高级）",
            jobEdu="本科",
            jobEx="1-3年",
            jobNature="实习",
            jobAge="18岁以上",
            jobAddress="上海",
            jobSalary="11K~15K",
            jobIndustry="计算机/互联网/通信/电子-计算机软件类",
            isPublishing="true",
            jobState="正在招聘",
            jobDetail="""薪资范围：11K~20K
        岗位职责：
        1、负责新产品、新平台设计、开发、调试；
        2、负责产品的迭代、技术创新；
        3、负责产品批量生产导出、成本压缩；
        任职要求：
        1、电子信息、信息与通信、微电子等专业全日制本科及以上学历；
        2、3年以上嵌入式硬件平台开发经验；
        3、熟悉嵌式硬件平台、SOC组成架构、CPU外围硬件电路的设计调试；
        4、熟悉设备级测试相关EMC/LVD/安规相关知识、能分析改善设备硬件设计；
        5、熟悉多层高速线路板的硬件（DDR4内存、千兆网、PCle等）设计；""",

            # e_job_id="1"
        )
        db.session.add(j1)
        db.session.commit()
        j2 = JobModel(
            jobId="2",
            jobName="Web前端实习生",
            jobEdu="本科",
            jobEx="经验不限",
            jobNature="兼职",
            jobAge="18-35岁",
            jobAddress="广州",
            jobSalary="8千-1.1万",
            jobIndustry="计算机/互联网/通信/电子-计算机软件类",
            isPublishing="false",
            jobState="已停止招聘",
            jobDetail="""岗位职责：
        1、负责平台的PC端、移动端的相关页面制作；
        2、根据产品需求，与产品、设计、后端程序开发人员对接。实现产品界面和功能；
        3、基于HTML标准和JavaScript进行页面制作，编写可用的用户界面组件；
        4、持续的优化前段体验和页面响应速度，并保证各浏览器兼容性和执行效率。
        任职要求：
        1、大专及以上学历，计算机相关专业，可接受2023届应届毕业生；
        2、熟悉w3c标准，对表现与数据分离、HTML语义化等有深刻理解；
        3、熟悉JavaScript、jQuery、Ajax等web开发技术；
        4、良好的团队协助意识和积极的工作态度，能够承受一定的工作压力""",

            # e_job_id="1"
        )
        db.session.add(j2)
        db.session.commit()
        j3 = JobModel(
            jobId="3",
            jobName="Python开发工程师",
            jobEdu="本科",
            jobEx="1-2年",
            jobAge="年龄不限",
            jobNature="全职",
            jobAddress="北京",
            jobSalary="11K~20K",
            jobIndustry="计算机/互联网/通信/电子-计算机软件类",
            isPublishing="true",
            jobState="正在招聘",
            jobDetail="""薪资范围：11K~20K
       岗位职责：

        1、 负责现场软硬件和企业级系统的实施工作；
        
        2、 根据实施方*，完成项目前期调研、策划，制定业务解决方案，形成项目应用方案，组织定制培训；
        
        3、 负责对所参与的项目进行运营管理，执行应用检视，输出应用场景，定期进行应用汇报；
        
        4、 配合市场完成相关展会、观摩会的策划和讲解；
        
        5、 定期收集用户反馈或需求，完成初步分析后提交产品部进行跟进；
        
        6、 协助配合客户经理，参与前期与客户的业务交流、系统演示、解决方案介绍。
        
        任职资格：
        
        1、2023年应届生，本科及以上学历，建筑、土木工程，工程管理等相关专业优先； 
        
        2、学习能力强、良好的沟通协作能力，具备方案撰写和ppt演示能力；
        校招岗位统一需要网申：
        网申路径：
         网申方式：关注公众号”广联达招聘“-校园招聘-2023届校招"""
            # e_job_id="2"
        )
        db.session.add(j3)
        db.session.commit()

        # for job in jobs:
        #     jobModel = JobModel()
        #     jobModel.jobId = job.jobId
        #     jobModel.jobName = job.jobName
        #     jobModel.jobEdu = job.jobEdu
        #     jobModel.jobEx = job.jobEx
        #     jobModel.jobDetail = job.jobDetail
        #     # jobModel.e_job_id = job.e_job_id
        #
        #     db.session.add(job)
        # db.session.commit()


# hr的数据模型
class HRModel(db.Model):
    __tablename__ = "hr"
    hrId = db.Column(db.String(255), primary_key=True, nullable=False)
    hrAvatarName = db.Column(db.String(255))
    hrName = db.Column(db.String(255))
    hrGender = db.Column(db.String(255))
    hrPassword = db.Column(db.String(255))
    hrEmail = db.Column(db.String(255), unique=True)
    hrPhone = db.Column(db.String(255), unique=True)
    hrLevel = db.Column(db.String(255))
    hrSignature = db.Column(db.String(255))

    e_hr_id = db.Column(db.String(255), db.ForeignKey("enterprise.eId"))
    hr_jobs = db.relationship("JobModel", backref="hr_list", lazy="dynamic", secondary="hr_job")

    # 初始化数据
    @staticmethod
    def init_db():
        faker = Faker(locale="zh_CN")
        hrs = []
        i = 10
        while i > 0:
            e = EnterpriseModel.query.all()
            ran = random.randint(0, len(e) - 1)
            email = faker.free_email()
            phone = faker.phone_number()

            new = HRModel(
                hrId=str(int(time.time() * 1000)) + str(i) + "1",
                hrAvatarName="hr_1.jpeg",
                hrName=faker.name(),
                hrGender=random.choice(["男", "女"]),
                hrPassword=generate_password_hash("123456"),
                hrEmail=email,
                hrPhone=phone,
                hrLevel="招聘者",
                hrSignature=faker.sentence(nb_words=6, variable_nb_words=True, ext_word_list=None),
                e_hr_id=e[ran].eId
            )
            try:
                h = HRModel.query.filter(or_(HRModel.hrPhone == phone, HRModel.hrEmail == email)).all()
                if not h:
                    db.session.add(new)
                    db.session.commit()
                    i = i - 1

            except PendingRollbackError as e:
                db.session.rollback()
                print(e)

        h1 = HRModel(
            hrId="h1",
            hrAvatarName="hr_1.jpeg",
            hrName="hr1",
            hrGender="女",
            hrPassword=generate_password_hash("123456"),
            hrEmail="h1@h.com",
            hrPhone="15234567922",
            hrLevel="招聘者",
            hrSignature="第一个程序就是Hello World",
            e_hr_id="1"
        )
        h2 = HRModel(
            hrId="h2",
            hrAvatarName="hr_2.jpeg",
            hrName="hr2",
            hrGender="男",
            hrPassword=generate_password_hash("123456"),
            hrEmail="h2@h.com",
            hrPhone="15822889903",
            hrLevel="招聘者",
            hrSignature="构建程序的过程本质上是对规范调试的过程",
            e_hr_id="1"
        )

        h3 = HRModel(
            hrId="h3",
            hrAvatarName="hr_7.jpeg",
            hrName="hr3",
            hrGender="男",
            hrPassword=generate_password_hash("123456"),
            hrEmail="h3@h.com",
            hrPhone="17888842299",
            hrLevel="招聘者",
            hrSignature="只做CV工程师",
            e_hr_id="2"
        )
        db.session.add(h1)
        db.session.commit()
        db.session.add(h2)
        db.session.commit()
        db.session.add(h3)
        db.session.commit()

        # for hr in hrs:
        #     jobModel = HRModel()
        #     jobModel.hrId = hr.hrId
        #     jobModel.hrAvatarName = hr.hrAvatarName
        #     jobModel.hrName = hr.hrName
        #     jobModel.hrGender = hr.hrGender
        #     jobModel.hrPassword = hr.hrPassword
        #     jobModel.hrEmail = hr.hrEmail
        #     jobModel.hrPhone = hr.hrPhone
        #     jobModel.hrLevel = hr.hrLevel
        #     jobModel.e_hr_id = hr.e_hr_id
        #
        #     db.session.add(hr)
        # db.session.commit()


# admin审核hr提交的企业信息
class EInfoConfirmingModel(db.Model):
    __tablename__ = "einfoconfirming"
    auditId = db.Column(db.String(255), primary_key=True)
    eId = db.Column(db.String(255))
    # 基本信息
    content = db.Column(db.Text(65535))
    size = db.Column(db.String(255))
    nature = db.Column(db.String(255))
    industry = db.Column(db.String(255))
    advantage = db.Column(db.String(255))
    # 联系方式和地址
    contactName = db.Column(db.String(255))
    contactPhone = db.Column(db.String(255))
    contactEmail = db.Column(db.String(255))
    contactAddress = db.Column(db.String(255))

    # # 工商信息
    businessName = db.Column(db.String(255))
    businessSetTime = db.Column(db.String(255))
    businessRegCapital = db.Column(db.String(255))
    businessLegalRepresentative = db.Column(db.String(255))

    # 提交的hr信息
    hrId = db.Column(db.String(255))
    hrName = db.Column(db.String(255))
    hrEmail = db.Column(db.String(255))
    hrPhone = db.Column(db.String(255))

    isAudit = db.Column(db.String(255))
    auditTime = db.Column(db.String(255))
    confirmTime = db.Column(db.String(255))
    auditState = db.Column(db.String(255))
    operationType = db.Column(db.String(255))
    auditResultContent = db.Column(db.String(255))


# time.strftime("%Y-%m-%d %H:%M:%S",time.gmtime())

# admin审核hr提交的岗位信息
class EJobConfirmingModel(db.Model):
    __tablename__ = "ejobconfirming"
    auditId = db.Column(db.String(255), primary_key=True)
    jobId = db.Column(db.String(255))
    jobName = db.Column(db.String(255))
    jobAddress = db.Column(db.String(255))
    jobNature = db.Column(db.String(255))
    jobEdu = db.Column(db.String(255))
    jobAge = db.Column(db.String(255))
    jobEx = db.Column(db.String(255))
    jobSalary = db.Column(db.String(255))
    jobDetail = db.Column(db.Text(65535))
    jobIndustry = db.Column(db.String(255))

    # 提交的hr信息
    hrId = db.Column(db.String(255))
    hrName = db.Column(db.String(255))
    hrEmail = db.Column(db.String(255))
    hrPhone = db.Column(db.String(255))

    isAudit = db.Column(db.String(255))
    auditTime = db.Column(db.String(255))
    confirmTime = db.Column(db.String(255))
    auditState = db.Column(db.String(255))
    auditResultContent = db.Column(db.String(255))
    operationType = db.Column(db.String(255))


# 管理员基本信息
class AdminModel(db.Model):
    __tablename__ = "admin"
    adminId = db.Column(db.String(255), primary_key=True, nullable=False)
    adminAvatar = db.Column(db.String(255))
    adminName = db.Column(db.String(255))
    adminEmail = db.Column(db.String(255))
    adminPhone = db.Column(db.String(255))
    adminPassword = db.Column(db.String(255))
    adminDetail = db.Column(db.Text(65535))

    @staticmethod
    def init_db():
        admins = [
            AdminModel(
                adminId="admin",
                adminAvatar="1.jpeg",
                adminName="admin",
                adminEmail="admin@admin.com",
                adminPhone="15977946136",
                adminPassword=generate_password_hash("123456"),
                adminDetail="不可能，我的代码绝对没有BUG！",

            )
        ]

        for admin in admins:
            db.session.add(admin)
        db.session.commit()


# 主页菜单
class HomeMenuModel(db.Model):
    __tablename__ = "menu"
    id = db.Column(db.Integer, primary_key=True, nullable=False)
    father = db.Column(db.String(255))
    children = db.Column(db.String(255))
    name = db.Column(db.String(255))

    @staticmethod
    def init_db():
        menus = [
            HomeMenuModel(
                father="0",
                children="1",
                name="计算机/互联网/通信/电子",
            ), HomeMenuModel(
                father="0",
                children="2",
                name="市场营销/销售/客服",
            ), HomeMenuModel(
                father="0",
                children="3",
                name="财务/金融/银行/保险/信托",
            ), HomeMenuModel(
                father="0",
                children="4",
                name="高级管理/人力资源/行政",
            ), HomeMenuModel(
                father="0",
                children="5",
                name="生产/工艺/能源/机械/技工",
            ), HomeMenuModel(
                father="0",
                children="6",
                name="建筑/房地产/物业",
            ), HomeMenuModel(
                father="0",
                children="7",
                name="贸易/物流/采购/运输",
            ), HomeMenuModel(
                father="0",
                children="8",
                name="化工/生物/制药/医疗/护理",
            ), HomeMenuModel(
                father="0",
                children="9",
                name="广告/媒体/艺术/会展",
            ), HomeMenuModel(
                father="0",
                children="10",
                name="咨询/法律/教育/培训/翻译",
            )
            , HomeMenuModel(
                father="1",
                children="11",
                name="计算机硬件类",
            ), HomeMenuModel(
                father="1",
                children="12",
                name="计算机软件类",
            ), HomeMenuModel(
                father="1",
                children="13",
                name="IT运维",
            ), HomeMenuModel(
                father="1",
                children="14",
                name="电子/电气",
            ), HomeMenuModel(
                father="11",
                children="111",
                name="高级硬件工程师",
            ), HomeMenuModel(
                father="11",
                children="112",
                name="嵌入式硬件开发",
            ), HomeMenuModel(
                father="11",
                children="113",
                name="硬件测试工程师",
            ), HomeMenuModel(
                father="12",
                children="121",
                name="软件架构设计师",
            ), HomeMenuModel(
                father="12",
                children="122",
                name="程序员",
            ), HomeMenuModel(
                father="12",
                children="123",
                name="算法工程师",
            ), HomeMenuModel(
                father="13",
                children="131",
                name="网络工程师",
            ), HomeMenuModel(
                father="13",
                children="132",
                name="数据库管理员",
            ), HomeMenuModel(
                father="13",
                children="133",
                name="网络与信息安全工程师",
            ), HomeMenuModel(
                father="14",
                children="141",
                name="电气工程师",
            ), HomeMenuModel(
                father="14",
                children="142",
                name="IC工程师",
            ), HomeMenuModel(
                father="14",
                children="143",
                name="电子工程师",
            )
            , HomeMenuModel(
                father="2",
                children="21",
                name="市场营销类",
            ), HomeMenuModel(
                father="2",
                children="22",
                name="销售管理",
            ), HomeMenuModel(
                father="2",
                children="23",
                name="销售业务",
            ), HomeMenuModel(
                father="2",
                children="24",
                name="销售行政",
            ), HomeMenuModel(
                father="2",
                children="25",
                name="客服/技术支持类",
            )
            , HomeMenuModel(
                father="21",
                children="211",
                name="市场总监",
            ), HomeMenuModel(
                father="21",
                children="212",
                name="产品专员",
            ), HomeMenuModel(
                father="21",
                children="213",
                name="营销策划主管",
            ), HomeMenuModel(
                father="21",
                children="214",
                name="网络推广",
            )
            , HomeMenuModel(
                father="22",
                children="221",
                name="销售总监",
            ), HomeMenuModel(
                father="22",
                children="122",
                name="客户经理",
            ), HomeMenuModel(
                father="22",
                children="223",
                name="销售项目经理",
            )
            , HomeMenuModel(
                father="23",
                children="231",
                name="销售工程师",
            ), HomeMenuModel(
                father="23",
                children="232",
                name="大客户销售代表",
            ), HomeMenuModel(
                father="23",
                children="233",
                name="团购业务员",
            )
            , HomeMenuModel(
                father="24",
                children="241",
                name="销售行政经理",
            ), HomeMenuModel(
                father="24",
                children="242",
                name="商务经理",
            ), HomeMenuModel(
                father="24",
                children="243",
                name="销售数据分析",
            )
            , HomeMenuModel(
                father="25",
                children="251",
                name="客服总监",
            ), HomeMenuModel(
                father="25",
                children="252",
                name="售前支持专员",
            ), HomeMenuModel(
                father="25",
                children="253",
                name="在线客服",
            )
            , HomeMenuModel(
                father="3",
                children="31",
                name="财务/审计/统计类",
            ), HomeMenuModel(
                father="3",
                children="32",
                name="证券/期货/投资类",
            ), HomeMenuModel(
                father="3",
                children="33",
                name="银行类",
            ), HomeMenuModel(
                father="3",
                children="34",
                name="保险类",
            )
            , HomeMenuModel(
                father="31",
                children="311",
                name="首席税务师CFO",
            ), HomeMenuModel(
                father="31",
                children="312",
                name="税务师",
            ), HomeMenuModel(
                father="31",
                children="313",
                name="审计师",
            ), HomeMenuModel(
                father="31",
                children="314",
                name="统计师",
            ), HomeMenuModel(
                father="31",
                children="315",
                name="财务分析员",
            )
            , HomeMenuModel(
                father="32",
                children="321",
                name="证券总监",
            ), HomeMenuModel(
                father="32",
                children="322",
                name="期货分析师",
            ), HomeMenuModel(
                father="32",
                children="323",
                name="经济研究员",
            ), HomeMenuModel(
                father="32",
                children="324",
                name="融资总监",
            ), HomeMenuModel(
                father="32",
                children="325",
                name="金融数据分析师",
            )
            , HomeMenuModel(
                father="33",
                children="331",
                name="银行行长",
            ), HomeMenuModel(
                father="33",
                children="332",
                name="银行柜员",
            ), HomeMenuModel(
                father="33",
                children="333",
                name="个人业务客户经理",
            )
            , HomeMenuModel(
                father="34",
                children="341",
                name="保险精算师",
            ), HomeMenuModel(
                father="34",
                children="342",
                name="保险培训师",
            ), HomeMenuModel(
                father="34",
                children="343",
                name="储备经理人",
            )
            , HomeMenuModel(
                father="4",
                children="41",
                name="高级管理类",
            ), HomeMenuModel(
                father="4",
                children="42",
                name="人力资源/人事类",
            ), HomeMenuModel(
                father="4",
                children="43",
                name="行政/文职/后勤类",
            )
            , HomeMenuModel(
                father="41",
                children="411",
                name="首席执行官CEO",
            ), HomeMenuModel(
                father="41",
                children="412",
                name="首席运营官COO",
            ), HomeMenuModel(
                father="41",
                children="413",
                name="企业发展战略规划部经理",
            ), HomeMenuModel(
                father="41",
                children="414",
                name="运营总监",
            ), HomeMenuModel(
                father="41",
                children="415",
                name="合伙人",
            )
            , HomeMenuModel(
                father="42",
                children="421",
                name="人事总监",
            ), HomeMenuModel(
                father="42",
                children="422",
                name="招聘专员",
            ), HomeMenuModel(
                father="42",
                children="423",
                name="培训师",
            ), HomeMenuModel(
                father="42",
                children="424",
                name="绩效考核专员",
            )
            , HomeMenuModel(
                father="43",
                children="431",
                name="行政总监",
            ), HomeMenuModel(
                father="43",
                children="432",
                name="前台",
            ), HomeMenuModel(
                father="43",
                children="433",
                name="图书管理员",
            ), HomeMenuModel(
                father="43",
                children="434",
                name="党工团干事",
            ), HomeMenuModel(
                father="43",
                children="435",
                name="行政司机",
            )
            , HomeMenuModel(
                father="5",
                children="51",
                name="生产制造类",
            ), HomeMenuModel(
                father="5",
                children="52",
                name="质量保证类",
            ), HomeMenuModel(
                father="5",
                children="53",
                name="电力/能源/测绘",
            ), HomeMenuModel(
                father="5",
                children="54",
                name="机械仪表类",
            ), HomeMenuModel(
                father="5",
                children="55",
                name="汽车制造类",
            ), HomeMenuModel(
                father="5",
                children="56",
                name="技工类",
            )
            , HomeMenuModel(
                father="51",
                children="511",
                name="厂长",
            ), HomeMenuModel(
                father="51",
                children="512",
                name="生产经理",
            ), HomeMenuModel(
                father="51",
                children="513",
                name="总工程师",
            ), HomeMenuModel(
                father="51",
                children="514",
                name="工业工程师（IE）",
            ), HomeMenuModel(
                father="51",
                children="515",
                name="研发经理",
            )
            , HomeMenuModel(
                father="52",
                children="521",
                name="品质管理经理（QA/QC经理）",
            ), HomeMenuModel(
                father="52",
                children="522",
                name="化验员",
            ), HomeMenuModel(
                father="52",
                children="523",
                name="环境工程师",
            ), HomeMenuModel(
                father="52",
                children="524",
                name="标准化工程师（ISO等）",
            )
            , HomeMenuModel(
                father="53",
                children="531",
                name="水电工程师",
            ), HomeMenuModel(
                father="53",
                children="532",
                name="石油和天然气开采",
            ), HomeMenuModel(
                father="53",
                children="533",
                name="地质/地质勘测",
            ), HomeMenuModel(
                father="53",
                children="534",
                name="电力系统研发工程师",
            ), HomeMenuModel(
                father="53",
                children="535",
                name="控制保护研发工程师",
            )
            , HomeMenuModel(
                father="54",
                children="541",
                name="工程机械经理",
            ), HomeMenuModel(
                father="54",
                children="542",
                name="设备工程师",
            ), HomeMenuModel(
                father="54",
                children="543",
                name="机械绘图员",
            ), HomeMenuModel(
                father="54",
                children="544",
                name="机电工程师",
            ), HomeMenuModel(
                father="54",
                children="545",
                name="核工业工程师",
            )
            , HomeMenuModel(
                father="55",
                children="551",
                name="汽车设计工程师",
            ), HomeMenuModel(
                father="55",
                children="552",
                name="汽车结构工程师",
            ), HomeMenuModel(
                father="55",
                children="553",
                name="汽车装配工艺工程师",
            ), HomeMenuModel(
                father="55",
                children="554",
                name="汽车安全性能工程师",
            ), HomeMenuModel(
                father="55",
                children="555",
                name="验车员",
            )
            , HomeMenuModel(
                father="56",
                children="561",
                name="钳工",
            ), HomeMenuModel(
                father="56",
                children="562",
                name="木工",
            ), HomeMenuModel(
                father="56",
                children="563",
                name="电工",
            ), HomeMenuModel(
                father="56",
                children="564",
                name="泥水工",
            ), HomeMenuModel(
                father="56",
                children="565",
                name="模具工",
            )
            , HomeMenuModel(
                father="6",
                children="61",
                name="建筑/工程类",
            ), HomeMenuModel(
                father="6",
                children="62",
                name="房产开发/中介类",
            ), HomeMenuModel(
                father="6",
                children="63",
                name="物业管理类",
            )
            , HomeMenuModel(
                father="61",
                children="611",
                name="高级建筑工程师",
            ), HomeMenuModel(
                father="61",
                children="612",
                name="幕墙工程师",
            ), HomeMenuModel(
                father="61",
                children="613",
                name="工程质量管理",
            ), HomeMenuModel(
                father="61",
                children="614",
                name="市政工程师",
            ), HomeMenuModel(
                father="61",
                children="615",
                name="建筑设计师",
            )
            , HomeMenuModel(
                father="62",
                children="621",
                name="房地产开发",
            ), HomeMenuModel(
                father="62",
                children="622",
                name="房地产评估",
            ), HomeMenuModel(
                father="62",
                children="623",
                name="房地产项目管理",
            ), HomeMenuModel(
                father="62",
                children="624",
                name="房地产销售主管",
            )
            , HomeMenuModel(
                father="63",
                children="631",
                name="高级物业顾问",
            ), HomeMenuModel(
                father="63",
                children="632",
                name="物业维修",
            ), HomeMenuModel(
                father="63",
                children="633",
                name="绿化工",
            ), HomeMenuModel(
                father="63",
                children="634",
                name="保洁员",
            ), HomeMenuModel(
                father="63",
                children="635",
                name="停车管理员",
            )
            , HomeMenuModel(
                father="7",
                children="71",
                name="贸易/进出口类",
            ), HomeMenuModel(
                father="7",
                children="72",
                name="物流/仓储类",
            ), HomeMenuModel(
                father="7",
                children="73",
                name="采购类",
            ), HomeMenuModel(
                father="7",
                children="74",
                name="交通运输服务",
            )
            , HomeMenuModel(
                father="71",
                children="711",
                name="外贸经理",
            ), HomeMenuModel(
                father="71",
                children="712",
                name="外贸专员",
            ), HomeMenuModel(
                father="71",
                children="713",
                name="报关",
            )
            , HomeMenuModel(
                father="72",
                children="721",
                name="物流总监",
            ), HomeMenuModel(
                father="72",
                children="722",
                name="供应链总监",
            ), HomeMenuModel(
                father="72",
                children="723",
                name="仓库经理",
            ), HomeMenuModel(
                father="72",
                children="724",
                name="运输经理",
            ), HomeMenuModel(
                father="72",
                children="725",
                name="海关事务管理",
            ), HomeMenuModel(
                father="72",
                children="726",
                name="集装箱业务操作",
            )
            , HomeMenuModel(
                father="73",
                children="731",
                name="采购总监",
            ), HomeMenuModel(
                father="73",
                children="732",
                name="供应商开发",
            ), HomeMenuModel(
                father="73",
                children="733",
                name="买手",
            )
            , HomeMenuModel(
                father="74",
                children="741",
                name="飞机机长",
            ), HomeMenuModel(
                father="74",
                children="742",
                name="乘务员",
            ), HomeMenuModel(
                father="74",
                children="743",
                name="地勤人员",
            ), HomeMenuModel(
                father="74",
                children="744",
                name="列车车长",
            ), HomeMenuModel(
                father="74",
                children="745",
                name="船长",
            ), HomeMenuModel(
                father="74",
                children="746",
                name="公路货车司机",
            ), HomeMenuModel(
                father="74",
                children="747",
                name="营运网约车司机",
            ), HomeMenuModel(
                father="74",
                children="748",
                name="代驾",
            )
            , HomeMenuModel(
                father="8",
                children="81",
                name="化工类",
            ), HomeMenuModel(
                father="8",
                children="82",
                name="轻工/食品/工艺品",
            ), HomeMenuModel(
                father="8",
                children="83",
                name="服装/纺织/皮革类",
            ), HomeMenuModel(
                father="8",
                children="84",
                name="医药/医疗器械类",
            ), HomeMenuModel(
                father="8",
                children="85",
                name="医院/医疗/护理类",
            )
            , HomeMenuModel(
                father="81",
                children="811",
                name="化工技术应用工程师",
            ), HomeMenuModel(
                father="81",
                children="812",
                name="化工研发工程师",
            ), HomeMenuModel(
                father="81",
                children="813",
                name="化妆品研发",
            ), HomeMenuModel(
                father="81",
                children="814",
                name="化工项目管理",
            )
            , HomeMenuModel(
                father="82",
                children="821",
                name="纸浆造纸工艺",
            ), HomeMenuModel(
                father="82",
                children="822",
                name="食品加工",
            ), HomeMenuModel(
                father="82",
                children="823",
                name="烟草制造工艺",
            ), HomeMenuModel(
                father="82",
                children="824",
                name="茶制品工艺",
            ), HomeMenuModel(
                father="82",
                children="825",
                name="金银首饰加工工艺",
            )
            , HomeMenuModel(
                father="83",
                children="831",
                name="服装设计",
            ), HomeMenuModel(
                father="83",
                children="832",
                name="纺织品设计",
            ), HomeMenuModel(
                father="83",
                children="833",
                name="底格出格师",
            ), HomeMenuModel(
                father="83",
                children="834",
                name="车板工",
            ), HomeMenuModel(
                father="83",
                children="835",
                name="皮革销售",
            )
            , HomeMenuModel(
                father="84",
                children="841",
                name="生物工程",
            ), HomeMenuModel(
                father="84",
                children="842",
                name="生物制药",
            ), HomeMenuModel(
                father="84",
                children="843",
                name="医药技术研发",
            ), HomeMenuModel(
                father="84",
                children="844",
                name="医药销售经理",
            ), HomeMenuModel(
                father="84",
                children="845",
                name="医疗器械维修",
            ), HomeMenuModel(
                father="84",
                children="846",
                name="医疗器械生产",
            ), HomeMenuModel(
                father="84",
                children="847",
                name="医药学术推广",
            )
            , HomeMenuModel(
                father="85",
                children="851",
                name="医院院长",
            ), HomeMenuModel(
                father="85",
                children="852",
                name="男科医生",
            ), HomeMenuModel(
                father="85",
                children="853",
                name="外科医生",
            ), HomeMenuModel(
                father="85",
                children="854",
                name="心理医生",
            ), HomeMenuModel(
                father="85",
                children="855",
                name="中医医生",
            ), HomeMenuModel(
                father="85",
                children="856",
                name="兽医",
            ), HomeMenuModel(
                father="85",
                children="857",
                name="护理主任",
            ), HomeMenuModel(
                father="85",
                children="858",
                name="护士",
            )
            , HomeMenuModel(
                father="9",
                children="91",
                name="广告类",
            ), HomeMenuModel(
                father="9",
                children="92",
                name="文字媒体/写作类",
            ), HomeMenuModel(
                father="9",
                children="93",
                name="出版/印刷类",
            ), HomeMenuModel(
                father="9",
                children="94",
                name="影视类",
            ), HomeMenuModel(
                father="9",
                children="95",
                name="艺术/设计类",
            )
            , HomeMenuModel(
                father="91",
                children="911",
                name="广告创意总监",
            ), HomeMenuModel(
                father="91",
                children="912",
                name="广告制作",
            ), HomeMenuModel(
                father="91",
                children="913",
                name="广告文案策划",
            )
            , HomeMenuModel(
                father="92",
                children="921",
                name="总编",
            ), HomeMenuModel(
                father="92",
                children="922",
                name="编辑",
            ), HomeMenuModel(
                father="92",
                children="923",
                name="记者",
            ), HomeMenuModel(
                father="92",
                children="924",
                name="美术编辑",
            )
            , HomeMenuModel(
                father="93",
                children="931",
                name="排版设计",
            ), HomeMenuModel(
                father="93",
                children="932",
                name="印刷操作工",
            ), HomeMenuModel(
                father="93",
                children="933",
                name="打稿机操作员",
            )
            , HomeMenuModel(
                father="94",
                children="941",
                name="影视策划",
            ), HomeMenuModel(
                father="94",
                children="942",
                name="导演",
            ), HomeMenuModel(
                father="94",
                children="943",
                name="艺术指导",
            ), HomeMenuModel(
                father="94",
                children="944",
                name="经纪人",
            ), HomeMenuModel(
                father="94",
                children="945",
                name="演员",
            ), HomeMenuModel(
                father="94",
                children="946",
                name="化妆师",
            ), HomeMenuModel(
                father="94",
                children="947",
                name="配音师",
            )
            , HomeMenuModel(
                father="95",
                children="951",
                name="设计总监",
            ), HomeMenuModel(
                father="95",
                children="952",
                name="Flash设计",
            ), HomeMenuModel(
                father="95",
                children="953",
                name="平面设计",
            ), HomeMenuModel(
                father="95",
                children="954",
                name="视觉设计",
            ), HomeMenuModel(
                father="95",
                children="955",
                name="改妆师",
            )
            , HomeMenuModel(
                father="10",
                children="101",
                name="咨询/顾问/中介类",
            ), HomeMenuModel(
                father="10",
                children="102",
                name="法律/法务/合规类",
            ), HomeMenuModel(
                father="10",
                children="103",
                name="文教/科研类",
            ), HomeMenuModel(
                father="10",
                children="104",
                name="培训类",
            ), HomeMenuModel(
                father="10",
                children="105",
                name="翻译",
            )
            , HomeMenuModel(
                father="101",
                children="1011",
                name="首席咨询师",
            ), HomeMenuModel(
                father="101",
                children="1012",
                name="专业情报信息分析员",
            ), HomeMenuModel(
                father="101",
                children="1013",
                name="专业顾问",
            ), HomeMenuModel(
                father="101",
                children="1014",
                name="婚姻服务",
            ), HomeMenuModel(
                father="101",
                children="1015",
                name="拍卖师",
            )
            , HomeMenuModel(
                father="102",
                children="1021",
                name="律师",
            ), HomeMenuModel(
                father="102",
                children="1022",
                name="法律顾问",
            ), HomeMenuModel(
                father="102",
                children="1023",
                name="书记员",
            ), HomeMenuModel(
                father="102",
                children="1024",
                name="司法鉴定",
            )
            , HomeMenuModel(
                father="103",
                children="1031",
                name="院校校长",
            ), HomeMenuModel(
                father="103",
                children="1032",
                name="大学教授",
            ), HomeMenuModel(
                father="103",
                children="1033",
                name="大学讲师",
            ), HomeMenuModel(
                father="103",
                children="1034",
                name="中小学教师",
            ), HomeMenuModel(
                father="103",
                children="1035",
                name="学前教育教师",
            ), HomeMenuModel(
                father="103",
                children="1036",
                name="自然科学研究员",
            )
            , HomeMenuModel(
                father="104",
                children="1041",
                name="培训督导",
            ), HomeMenuModel(
                father="104",
                children="1042",
                name="培训讲师",
            ), HomeMenuModel(
                father="104",
                children="1043",
                name="培训策划",
            ), HomeMenuModel(
                father="104",
                children="1044",
                name="培训产品开发",
            ), HomeMenuModel(
                father="104",
                children="1045",
                name="培训课程顾问",
            )
            , HomeMenuModel(
                father="105",
                children="1051",
                name="英语翻译",
            ), HomeMenuModel(
                father="105",
                children="1052",
                name="日语翻译",
            ), HomeMenuModel(
                father="105",
                children="1053",
                name="德语翻译",
            ), HomeMenuModel(
                father="105",
                children="1054",
                name="法语翻译",
            ), HomeMenuModel(
                father="105",
                children="1055",
                name="俄语翻译",
            )
        ]

        for menu in menus:
            db.session.add(menu)
        db.session.commit()
